﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Justin.Stock.Models;

namespace Justin.Stock
{
    public partial class SystemSetting : Form
    {
        public SystemSetting()
        {
            InitializeComponent();
        }

        private void SystemSetting_FormClosing(object sender, FormClosingEventArgs e)
        {
        }

        private void SystemSetting_Load(object sender, EventArgs e)
        {
            RefreshSetting();
        }
        private void RefreshSetting()
        {
            txtBalance.Text = StockSetting.Balance.ToString();
            txtDesktopDisplayFormat.Text = StockSetting.DeskDisplayFormat;
            ToolTip tip = new ToolTip();
            tip.ToolTipTitle = "0:简称1：当前价格2：涨跌3：盈亏4:购入价5:股数6:换手率";
            checkBoxShowWarn.Checked = StockSetting.ShowWarn;
        }
        private void btnBalance_Click(object sender, EventArgs e)
        {
            StockSetting.Balance = decimal.Parse(txtBalance.Text.Trim());
        }

        private void btnDeskDisplayFormat_Click(object sender, EventArgs e)
        {
            StockSetting.DeskDisplayFormat = txtDesktopDisplayFormat.Text.Trim();
        }

        private void btnShowWarn_Click(object sender, EventArgs e)
        {
            StockSetting.ShowWarn = checkBoxShowWarn.Checked;
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            RefreshSetting();
        }
    }
}
